#include <coroutine>
#include <iostream>
#include <fstream>
#include <unistd.h>
#include <socket.h>
#include <arpa/inet.h>
#include <chrono>
#include <random>
#include <regex>
#include <ctime>
#include <fcntl.h>
#include "loop.h"
#include "http/server.h"
#include "http/parser.h"
#include "async/function.h"
#include "http/Router.h"

using namespace std;


int main()
{
    //! config url router
    router += {
            path("^$", new View(), "index"),
            path("^hello/", new HelloView(), "hello"),
            };

    //! start server
    auto loop = event_loop();
    auto svr = Server(&loop);

    svr.listen("127.0.0.1", 9090);
    loop.add_socket(&svr);
    loop.run(true);
}
